/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.llantas.modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author manuel
 */
@Entity
@Table(name = "detalleventa")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Detalleventa.findAll", query = "SELECT d FROM Detalleventa d"),
    @NamedQuery(name = "Detalleventa.findByIddetalleVenta", query = "SELECT d FROM Detalleventa d WHERE d.iddetalleVenta = :iddetalleVenta"),
    @NamedQuery(name = "Detalleventa.findByArticulo", query = "SELECT d FROM Detalleventa d WHERE d.articulo = :articulo"),
    @NamedQuery(name = "Detalleventa.findByCantidad", query = "SELECT d FROM Detalleventa d WHERE d.cantidad = :cantidad"),
    @NamedQuery(name = "Detalleventa.findByPrecioUnitario", query = "SELECT d FROM Detalleventa d WHERE d.precioUnitario = :precioUnitario"),
    @NamedQuery(name = "Detalleventa.findByPrecioTotal", query = "SELECT d FROM Detalleventa d WHERE d.precioTotal = :precioTotal"),
    @NamedQuery(name = "Detalleventa.findByVendedor", query = "SELECT d FROM Detalleventa d WHERE d.vendedor = :vendedor"),
    @NamedQuery(name = "Detalleventa.findByFecha", query = "SELECT d FROM Detalleventa d WHERE d.fecha = :fecha")})
public class Detalleventa implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "iddetalleVenta")
    private Integer iddetalleVenta;
    @Size(max = 45)
    @Column(name = "articulo")
    private String articulo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cantidad")
    private int cantidad;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "precioUnitario")
    private Float precioUnitario;
    @Column(name = "precioTotal")
    private Float precioTotal;
    @Size(max = 45)
    @Column(name = "vendedor")
    private String vendedor;
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @JoinColumn(name = "venta_idventa", referencedColumnName = "idventa")
    @ManyToOne
    private Venta ventaIdventa;

    public Detalleventa() {
    }

    public Detalleventa(Integer iddetalleVenta) {
        this.iddetalleVenta = iddetalleVenta;
    }

    public Detalleventa(Integer iddetalleVenta, int cantidad) {
        this.iddetalleVenta = iddetalleVenta;
        this.cantidad = cantidad;
    }

    public Integer getIddetalleVenta() {
        return iddetalleVenta;
    }

    public void setIddetalleVenta(Integer iddetalleVenta) {
        this.iddetalleVenta = iddetalleVenta;
    }

    public String getArticulo() {
        return articulo;
    }

    public void setArticulo(String articulo) {
        this.articulo = articulo;
    }

    public int getCantidad() {
        return cantidad;
    }

    public void setCantidad(int cantidad) {
        this.cantidad = cantidad;
    }

    public Float getPrecioUnitario() {
        return precioUnitario;
    }

    public void setPrecioUnitario(Float precioUnitario) {
        this.precioUnitario = precioUnitario;
    }

    public Float getPrecioTotal() {
        return precioTotal;
    }

    public void setPrecioTotal(Float precioTotal) {
        this.precioTotal = precioTotal;
    }

    public String getVendedor() {
        return vendedor;
    }

    public void setVendedor(String vendedor) {
        this.vendedor = vendedor;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Venta getVentaIdventa() {
        return ventaIdventa;
    }

    public void setVentaIdventa(Venta ventaIdventa) {
        this.ventaIdventa = ventaIdventa;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iddetalleVenta != null ? iddetalleVenta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Detalleventa)) {
            return false;
        }
        Detalleventa other = (Detalleventa) object;
        if ((this.iddetalleVenta == null && other.iddetalleVenta != null) || (this.iddetalleVenta != null && !this.iddetalleVenta.equals(other.iddetalleVenta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.llantas.modelo.Detalleventa[ iddetalleVenta=" + iddetalleVenta + " ]";
    }
    
}
